import { createI18n } from 'vue-i18n'
import zhCN from './zh-CN'
import enUS from './en-US'
import jaJP from './ja-JP'

export type LocaleType = 'zh-CN' | 'en-US' | 'ja-JP'

const defaultLocale: LocaleType =
  (import.meta.env.VITE_APP_LOCALE as LocaleType) || 'zh-CN'

const messages = {
  'zh-CN': zhCN,
  'en-US': enUS,
  'ja-JP': jaJP,
}

export const i18n = createI18n({
  legacy: false,
  locale: defaultLocale,
  fallbackLocale: 'zh-CN',
  messages,
})

export function setupI18n(app: import('vue').App) {
  app.use(i18n)
}


